﻿<%@ Page Title="" Language="C#" MasterPageFile="~/AdminCP/admincp.Master" AutoEventWireup="true"
    CodeBehind="ListUser.aspx.cs" Inherits="VINETLIFE.AdminCP.ListUser" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <div id="gridview">
                <asp:GridView ID="gridView" runat="server" CssClass="tstyle1" Width="100%" AutoGenerateColumns="False"
                    CellPadding="3" EnableModelValidation="True" GridLines="None" AllowPaging="True"
                    BackColor="White" BorderColor="White" BorderStyle="Ridge" BorderWidth="2px" CellSpacing="1"
                    PageSize="10" OnRowDataBound="gridView_RowDataBound" OnPageIndexChanging="gridView_PageIndexChanging"
                    OnRowDeleting="gridView_RowDeleting" EmptyDataText="Dữ liệu trống !" OnRowCommand="gridView_RowCommand"
                    OnSelectedIndexChanged="gridView_SelectedIndexChanged">
                    <Columns>
                        <asp:TemplateField>
                            <ItemTemplate>
                                <%# Container.DataItemIndex+1 %>
                            </ItemTemplate>
                            <ItemStyle Width="5%" />
                        </asp:TemplateField>
                        
                        <asp:TemplateField HeaderText="Họ tên">
                            <ItemTemplate>
                                <asp:Label ID="lbUser" runat="server" Text='<%#Eval("FullName")%>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle HorizontalAlign="Center" />
                            <ItemStyle Width="10%" HorizontalAlign="Center" />
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Tên đăng nhập">
                            <ItemTemplate>
                                <asp:Label ID="lbName" runat="server" Text='<%#Eval("UserName")%>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle HorizontalAlign="Center" />
                            <ItemStyle Width="15%" HorizontalAlign="Center" />
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Mật khẩu">
                            <ItemTemplate>
                                <asp:Label ID="lbPassword" runat="server" Text='<%# Eval("Password")%>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle HorizontalAlign="Center" />
                            <ItemStyle Width="10%" HorizontalAlign="Center" />
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Email">
                            <ItemTemplate>
                                <asp:Label ID="lbEmail" runat="server" Text='<%# Eval("Email")%>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle HorizontalAlign="Center" />
                            <ItemStyle Width="15%" HorizontalAlign="Center" />
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Phân quyền">
                            <ItemTemplate>
                                <asp:Label ID="lbxEmail" runat="server" Text=' <%#ReturnType(Eval("UserType")) %>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle HorizontalAlign="Center" />
                            <ItemStyle Width="15%" HorizontalAlign="Center" />
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Địa chỉ">
                            <ItemTemplate>
                                <asp:Label ID="lbAddress" runat="server" Text='<%# Eval("Address")%>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle HorizontalAlign="Center" />
                            <ItemStyle Width="10%" HorizontalAlign="Center" />
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Tình trạng">
                            <ItemTemplate>
                                <asp:Label ID="lbIsActive" runat="server" Text='<%# ((Boolean)Eval("IsActive")) == true ? "Đã kích hoạt" : "Đã khóa" %>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle HorizontalAlign="Center" />
                            <ItemStyle Width="10%" HorizontalAlign="Center" />
                        </asp:TemplateField>
                        <asp:ButtonField CommandName="view" HeaderText="Chi tiết" Visible="false">
                            <HeaderStyle HorizontalAlign="Center" />
                            <ItemStyle ForeColor="#000099" CssClass="btnView" Width="10px" HorizontalAlign="Center" />
                        </asp:ButtonField>
                        <asp:TemplateField HeaderText="Thao tác">
                            <ItemTemplate>
                                <asp:ImageButton ID="btEdit" runat="server" CommandArgument='<%#Eval("UserID") %>' CausesValidation="False"
                                    CommandName="Select" ImageUrl="~/AdminCP/images/edit_16x16.gif" />
                                <asp:ImageButton ID="btDelete" runat="server" CommandArgument='<%#Eval("UserID") %>' CausesValidation="False"
                                    CommandName="Delete" ImageUrl="~/AdminCP/images/delete_16x16.gif" OnClientClick="return confirm('Có muốn xóa bản ghi này? Nhấn OK để xóa!')" />
                            </ItemTemplate>
                            <HeaderStyle HorizontalAlign="Center" />
                            <ItemStyle Width="10%" HorizontalAlign="Center" />
                        </asp:TemplateField>
                    </Columns>
                </asp:GridView>
                <asp:UpdateProgress ID="UpdateProgress1" runat="server">
                    <ProgressTemplate>
                        <img src="../../Images/ajax-loader.gif" alt="Loadding" style="position: absolute;
                            top: 50%; left: 50%; z-index: 1000" />
                    </ProgressTemplate>
                </asp:UpdateProgress>
                 
            </div>
            <div>
                <table style="width: 100%">
                    <tr>
                        <td align="left" valign="top">
                            <asp:Button runat="server" ID="btnThemMoi" Text="Thêm mới" CssClass="button-gg-green"
                                OnClick="btnThemMoi_Click" CausesValidation="False" />
                        </td>
                    </tr>
                </table>
            </div>
             <fieldset id="details" visible="false" class="fieldset" runat="server">
                <legend>Nhập thông tin</legend>
                <div style="margin-top: 10px; padding-left: 150px;">
                    <table style="font-size: 12px;" width="100%" cellspacing="0">
                        <tr>
                            <td class="style1">
                                Tên đăng nhập:
                            </td>
                            <td>
                                <asp:TextBox ID="ltUsername" Width="250px" runat="server" /><asp:RequiredFieldValidator
                                    ID="RequiredFieldValidator1" runat="server" 
                                    ErrorMessage="*" ControlToValidate="ltUsername"></asp:RequiredFieldValidator>
                            </td>
                        </tr>
                        <tr>
                            <td class="style1">
                                Mật khẩu:
                            </td>
                            <td>
                                <asp:TextBox ID="ltPassword" Width="250px" runat="server" TextMode="Password" /><asp:RequiredFieldValidator
                                    ID="RequiredFieldValidator2" runat="server" 
                                    ErrorMessage="*" ControlToValidate="ltPassword"></asp:RequiredFieldValidator>
                            </td>
                        </tr>
                        <tr>
                            <td class="style1">
                                Xác nhận mật khẩu:
                            </td>
                            <td>
                                <asp:TextBox ID="ltPassrepeat" Width="250px" runat="server" 
                                    TextMode="Password" /><asp:RequiredFieldValidator
                                    ID="RequiredFieldValidator3" runat="server" 
                                    ErrorMessage="*" ControlToValidate="ltPassrepeat"></asp:RequiredFieldValidator>
                                <asp:CompareValidator ID="CompareValidator1" runat="server" 
                                    ControlToCompare="ltPassword" ControlToValidate="ltPassrepeat" ErrorMessage="*"></asp:CompareValidator>
                            </td>
                        </tr>
                        <tr>
                            <td class="style1">
                                Họ tên:
                            </td>
                            <td>
                                <asp:TextBox ID="ltFullname" Width="250px" runat="server" />
                            </td>
                        </tr>
                        <tr>
                            <td class="style1">
                                Email :
                            </td>
                            <td>
                                <asp:TextBox ID="ltEmail" Width="250px" runat="server" />
                                <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" 
                                    ControlToValidate="ltEmail" ErrorMessage="*" 
                                    ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"></asp:RegularExpressionValidator>
                            </td>
                        </tr>
                        <tr>
                            <td class="style1">
                                Yahoo :
                            </td>
                            <td>
                                <asp:TextBox ID="ltYahoo" Width="250px" runat="server" />
                            </td>
                        </tr>
                        <tr>
                            <td style="padding-bottom: 5px;" class="style1">
                                Địa chỉ :
                            </td>
                            <td>
                                <asp:TextBox ID="ltAddress" Width="250px" runat="server" />
                            </td>
                        </tr>
                        
                        <tr>
                            <td class="style1">
                                Trạng thái:
                            </td>
                            <td>                                                                             
                                <asp:RadioButton ID="rdCheck" GroupName="status" runat="server" 
                                    Checked="True" />Đã kích hoạt
                                &nbsp;&nbsp;&nbsp;
                                <asp:RadioButton ID="rdCheck1" GroupName="status" runat="server" />Đã khóa
                            </td>
                        </tr>
                        <tr>
                            <td style="padding-bottom: 5px;" class="style1">
                            </td>
                            <td>
                                <asp:Button ID="btnCapnhat" CssClass="button-gg-green" runat="server" Text="Thêm"
                                    Visible="true" OnClick="btnCapnhat_Click" />&nbsp;
                                    <asp:Button ID="btnLamLai" CssClass="button-gg-green" runat="server" Text="Làm lại"
                                    Visible="true" OnClick="btnThemMoi_Click" CausesValidation="False" />&nbsp;
                                <asp:Button ID="btnSua" CssClass="button-gg-green" runat="server" Text="Hủy" 
                                    OnClick="btnSua_Click" CausesValidation="False" />
                            </td>
                        </tr>
                    </table>
                </div>
            </fieldset>
       </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>
